package com.fisco.app.contract;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.v3.client.Client;
import org.fisco.bcos.sdk.v3.codec.datatypes.Event;
import org.fisco.bcos.sdk.v3.codec.datatypes.Function;
import org.fisco.bcos.sdk.v3.codec.datatypes.Type;
import org.fisco.bcos.sdk.v3.codec.datatypes.TypeReference;
import org.fisco.bcos.sdk.v3.codec.datatypes.Utf8String;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.Int256;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.v3.contract.Contract;
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
import org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.v3.model.CryptoType;
import org.fisco.bcos.sdk.v3.model.TransactionReceipt;
import org.fisco.bcos.sdk.v3.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.v3.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class TestCRUD extends Contract {
    public static final String[] BINARY_ARRAY = {"60806040523480156200001157600080fd5b506060600267ffffffffffffffff811180156200002d57600080fd5b506040519080825280602002602001820160405280156200006357816020015b60608152602001906001900390816200004d5790505b5090506040518060400160405280600381526020017f616765000000000000000000000000000000000000000000000000000000000081525081600081518110620000aa57fe5b60200260200101819052506040518060400160405280600381526020017f74656c000000000000000000000000000000000000000000000000000000000081525081600181518110620000f957fe5b60200260200101819052506200010e620003ab565b60405180604001604052806040518060400160405280600481526020017f6e616d6500000000000000000000000000000000000000000000000000000000815250815260200183815250905061100273ffffffffffffffffffffffffffffffffffffffff166331a5a51e6040518060400160405280600681526020017f706572736f6e0000000000000000000000000000000000000000000000000000815250836040518363ffffffff1660e01b8152600401620001ce92919062000612565b602060405180830381600087803b158015620001e957600080fd5b505af1158015620001fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200022491906200041f565b50600061100273ffffffffffffffffffffffffffffffffffffffff1663f23f63c96040518060400160405280600681526020017f706572736f6e00000000000000000000000000000000000000000000000000008152506040518263ffffffff1660e01b8152600401620002999190620005ee565b60206040518083038186803b158015620002b257600080fd5b505afa158015620002c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002ed9190620003f3565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141562000362576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000359906200064d565b60405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505062000791565b604051806040016040528060608152602001606081525090565b600081519050620003d6816200075d565b92915050565b600081519050620003ed8162000777565b92915050565b6000602082840312156200040657600080fd5b60006200041684828501620003c5565b91505092915050565b6000602082840312156200043257600080fd5b60006200044284828501620003dc565b91505092915050565b6000620004598383620004e2565b905092915050565b60006200046e826200067f565b6200047a8185620006a2565b9350836020820285016200048e856200066f565b8060005b85811015620004d05784840389528151620004ae85826200044b565b9450620004bb8362000695565b925060208a0199505060018101905062000492565b50829750879550505050505092915050565b6000620004ef826200068a565b620004fb8185620006b3565b93506200050d81856020860162000716565b62000518816200074c565b840191505092915050565b600062000530826200068a565b6200053c8185620006c4565b93506200054e81856020860162000716565b62000559816200074c565b840191505092915050565b600062000573601383620006c4565b91507f637265617465207461626c65206661696c6564000000000000000000000000006000830152602082019050919050565b60006040830160008301518482036000860152620005c58282620004e2565b91505060208301518482036020860152620005e1828262000461565b9150508091505092915050565b600060208201905081810360008301526200060a818462000523565b905092915050565b600060408201905081810360008301526200062e818562000523565b90508181036020830152620006448184620005a6565b90509392505050565b60006020820190508181036000830152620006688162000564565b9050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000620006e282620006f6565b9050919050565b60008160030b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60005b838110156200073657808201518184015260208101905062000719565b8381111562000746576000848401525b50505050565b6000601f19601f8301169050919050565b6200076881620006d5565b81146200077457600080fd5b50565b6200078281620006e9565b81146200078e57600080fd5b50565b610ec780620007a16000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80632fe99bdc1461005157806331c3e4561461008157806380599e4b146100b1578063fcd7e3c1146100e1575b600080fd5b61006b6004803603810190610066919061091b565b610113565b6040516100789190610c0e565b60405180910390f35b61009b6004803603810190610096919061091b565b6102ae565b6040516100a89190610c0e565b60405180910390f35b6100cb60048036038101906100c691906108da565b6104c3565b6040516100d89190610c0e565b60405180910390f35b6100fb60048036038101906100f691906108da565b6105b7565b60405161010a93929190610c82565b60405180910390f35b60006060600267ffffffffffffffff8111801561012f57600080fd5b5060405190808252806020026020018201604052801561016357816020015b606081526020019060019003908161014e5790505b509050838160008151811061017457fe5b6020026020010181905250828160018151811061018d57fe5b60200260200101819052506101a06106d0565b604051806040016040528087815260200183815250905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c6e105f836040518263ffffffff1660e01b81526004016102139190610cce565b602060405180830381600087803b15801561022d57600080fd5b505af1158015610241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026591906108b1565b60030b90507fc57b01fa77f41df77eaab79a0e2623fab2e7ae3e9530d9b1cab225ad65f2b7ce816040516102999190610c0e565b60405180910390a18093505050509392505050565b60006060600267ffffffffffffffff811180156102ca57600080fd5b5060405190808252806020026020018201604052801561030457816020015b6102f16106ea565b8152602001906001900390816102e95790505b50905060405180604001604052806040518060400160405280600381526020017f61676500000000000000000000000000000000000000000000000000000000008152508152602001858152508160008151811061035e57fe5b602002602001018190525060405180604001604052806040518060400160405280600381526020017f74656c0000000000000000000000000000000000000000000000000000000000815250815260200184815250816001815181106103c057fe5b602002602001018190525060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166341ffd75f87846040518363ffffffff1660e01b8152600401610429929190610c4b565b602060405180830381600087803b15801561044357600080fd5b505af1158015610457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047b91906108b1565b60030b90507f8e5890af40fc24a059396aca2f83d6ce41fcef086876548fa4fb8ec27e9d292a816040516104af9190610c0e565b60405180910390a180925050509392505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166380599e4b846040518263ffffffff1660e01b81526004016105209190610c29565b602060405180830381600087803b15801561053a57600080fd5b505af115801561054e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057291906108b1565b60030b90507f4b930e280fe29620bdff00c88155d46d6d82a39f45dd5c3ea114dc3157358112816040516105a69190610c0e565b60405180910390a180915050919050565b60608060606105c46106d0565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fcd7e3c1866040518263ffffffff1660e01b815260040161061e9190610c29565b60006040518083038186803b15801561063657600080fd5b505afa15801561064a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061067391906109b2565b9050606080600283602001515114156106bd57826020015160008151811061069757fe5b6020026020010151915082602001516001815181106106b257fe5b602002602001015190505b8682829550955095505050509193909250565b604051806040016040528060608152602001606081525090565b604051806040016040528060608152602001606081525090565b600082601f83011261071557600080fd5b815161072861072382610d1d565b610cf0565b9150818183526020840193506020810190508360005b8381101561076e578151860161075488826107e1565b84526020840193506020830192505060018101905061073e565b5050505092915050565b60008151905061078781610e7a565b92915050565b600082601f83011261079e57600080fd5b81356107b16107ac82610d45565b610cf0565b915080825260208301602083018583830111156107cd57600080fd5b6107d8838284610e27565b50505092915050565b600082601f8301126107f257600080fd5b815161080561080082610d45565b610cf0565b9150808252602083016020830185838301111561082157600080fd5b61082c838284610e36565b50505092915050565b60006040828403121561084757600080fd5b6108516040610cf0565b9050600082015167ffffffffff","ffffff81111561086d57600080fd5b610879848285016107e1565b600083015250602082015167ffffffffffffffff81111561089957600080fd5b6108a584828501610704565b60208301525092915050565b6000602082840312156108c357600080fd5b60006108d184828501610778565b91505092915050565b6000602082840312156108ec57600080fd5b600082013567ffffffffffffffff81111561090657600080fd5b6109128482850161078d565b91505092915050565b60008060006060848603121561093057600080fd5b600084013567ffffffffffffffff81111561094a57600080fd5b6109568682870161078d565b935050602084013567ffffffffffffffff81111561097357600080fd5b61097f8682870161078d565b925050604084013567ffffffffffffffff81111561099c57600080fd5b6109a88682870161078d565b9150509250925092565b6000602082840312156109c457600080fd5b600082015167ffffffffffffffff8111156109de57600080fd5b6109ea84828501610835565b91505092915050565b60006109ff8383610b14565b905092915050565b6000610a138383610bca565b905092915050565b6000610a2682610d91565b610a308185610dcc565b935083602082028501610a4285610d71565b8060005b85811015610a7e5784840389528151610a5f85826109f3565b9450610a6a83610db2565b925060208a01995050600181019050610a46565b50829750879550505050505092915050565b6000610a9b82610d9c565b610aa58185610ddd565b935083602082028501610ab785610d81565b8060005b85811015610af35784840389528151610ad48582610a07565b9450610adf83610dbf565b925060208a01995050600181019050610abb565b50829750879550505050505092915050565b610b0e81610e10565b82525050565b6000610b1f82610da7565b610b298185610dee565b9350610b39818560208601610e36565b610b4281610e69565b840191505092915050565b6000610b5882610da7565b610b628185610dff565b9350610b72818560208601610e36565b610b7b81610e69565b840191505092915050565b60006040830160008301518482036000860152610ba38282610b14565b91505060208301518482036020860152610bbd8282610a1b565b9150508091505092915050565b60006040830160008301518482036000860152610be78282610b14565b91505060208301518482036020860152610c018282610b14565b9150508091505092915050565b6000602082019050610c236000830184610b05565b92915050565b60006020820190508181036000830152610c438184610b4d565b905092915050565b60006040820190508181036000830152610c658185610b4d565b90508181036020830152610c798184610a90565b90509392505050565b60006060820190508181036000830152610c9c8186610b4d565b90508181036020830152610cb08185610b4d565b90508181036040830152610cc48184610b4d565b9050949350505050565b60006020820190508181036000830152610ce88184610b86565b905092915050565b6000604051905081810181811067ffffffffffffffff82111715610d1357600080fd5b8060405250919050565b600067ffffffffffffffff821115610d3457600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610d5c57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b60008160030b9050919050565b82818337600083830152505050565b60005b83811015610e54578082015181840152602081019050610e39565b83811115610e63576000848401525b50505050565b6000601f19601f8301169050919050565b610e8381610e1a565b8114610e8e57600080fd5b5056fea26469706673582212209e346ce0900ac4f79f64063cc88cf82493217c14515a863032c3ebdc4efd353364736f6c634300060a0033"};

    public static final String BINARY = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {"60806040523480156200001157600080fd5b506060600267ffffffffffffffff811180156200002d57600080fd5b506040519080825280602002602001820160405280156200006357816020015b60608152602001906001900390816200004d5790505b5090506040518060400160405280600381526020017f616765000000000000000000000000000000000000000000000000000000000081525081600081518110620000aa57fe5b60200260200101819052506040518060400160405280600381526020017f74656c000000000000000000000000000000000000000000000000000000000081525081600181518110620000f957fe5b60200260200101819052506200010e620003ab565b60405180604001604052806040518060400160405280600481526020017f6e616d6500000000000000000000000000000000000000000000000000000000815250815260200183815250905061100273ffffffffffffffffffffffffffffffffffffffff1663cadb64626040518060400160405280600681526020017f706572736f6e0000000000000000000000000000000000000000000000000000815250836040518363ffffffff1660e01b8152600401620001ce92919062000612565b602060405180830381600087803b158015620001e957600080fd5b505af1158015620001fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200022491906200041f565b50600061100273ffffffffffffffffffffffffffffffffffffffff166359a48b656040518060400160405280600681526020017f706572736f6e00000000000000000000000000000000000000000000000000008152506040518263ffffffff1660e01b8152600401620002999190620005ee565b60206040518083038186803b158015620002b257600080fd5b505afa158015620002c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002ed9190620003f3565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141562000362576040517fc703cb1200000000000000000000000000000000000000000000000000000000815260040162000359906200064d565b60405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505062000791565b604051806040016040528060608152602001606081525090565b600081519050620003d6816200075d565b92915050565b600081519050620003ed8162000777565b92915050565b6000602082840312156200040657600080fd5b60006200041684828501620003c5565b91505092915050565b6000602082840312156200043257600080fd5b60006200044284828501620003dc565b91505092915050565b6000620004598383620004e2565b905092915050565b60006200046e826200067f565b6200047a8185620006a2565b9350836020820285016200048e856200066f565b8060005b85811015620004d05784840389528151620004ae85826200044b565b9450620004bb8362000695565b925060208a0199505060018101905062000492565b50829750879550505050505092915050565b6000620004ef826200068a565b620004fb8185620006b3565b93506200050d81856020860162000716565b62000518816200074c565b840191505092915050565b600062000530826200068a565b6200053c8185620006c4565b93506200054e81856020860162000716565b62000559816200074c565b840191505092915050565b600062000573601383620006c4565b91507f637265617465207461626c65206661696c6564000000000000000000000000006000830152602082019050919050565b60006040830160008301518482036000860152620005c58282620004e2565b91505060208301518482036020860152620005e1828262000461565b9150508091505092915050565b600060208201905081810360008301526200060a818462000523565b905092915050565b600060408201905081810360008301526200062e818562000523565b90508181036020830152620006448184620005a6565b90509392505050565b60006020820190508181036000830152620006688162000564565b9050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000620006e282620006f6565b9050919050565b60008160030b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60005b838110156200073657808201518184015260208101905062000719565b8381111562000746576000848401525b50505050565b6000601f19601f8301169050919050565b6200076881620006d5565b81146200077457600080fd5b50565b6200078281620006e9565b81146200078e57600080fd5b50565b610ec780620007a16000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631724a182146100515780635b325d781461008157806386b733f9146100b35780639b6ba099146100e3575b600080fd5b61006b6004803603810190610066919061091b565b610113565b6040516100789190610c0e565b60405180910390f35b61009b600480360381019061009691906108da565b6102ae565b6040516100aa93929190610c82565b60405180910390f35b6100cd60048036038101906100c891906108da565b6103c7565b6040516100da9190610c0e565b60405180910390f35b6100fd60048036038101906100f8919061091b565b6104bb565b60405161010a9190610c0e565b60405180910390f35b60006060600267ffffffffffffffff8111801561012f57600080fd5b5060405190808252806020026020018201604052801561016357816020015b606081526020019060019003908161014e5790505b509050838160008151811061017457fe5b6020026020010181905250828160018151811061018d57fe5b60200260200101819052506101a06106d0565b604051806040016040528087815260200183815250905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634c8b9530836040518263ffffffff1660e01b81526004016102139190610cce565b602060405180830381600087803b15801561022d57600080fd5b505af1158015610241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026591906108b1565b60030b90507fdfc533ec2b52797a1229dc2495dbd3f4948f7c4c982ec077ad9d80810ec5c1f9816040516102999190610c0e565b60405180910390a18093505050509392505050565b60608060606102bb6106d0565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b325d78866040518263ffffffff1660e01b81526004016103159190610c29565b60006040518083038186803b15801561032d57600080fd5b505afa158015610341573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061036a91906109b2565b9050606080600283602001515114156103b457826020015160008151811061038e57fe5b6020026020010151915082602001516001815181106103a957fe5b602002602001015190505b8682829550955095505050509193909250565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166386b733f9846040518263ffffffff1660e01b81526004016104249190610c29565b602060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906108b1565b60030b90507fe7769b56c2afa8e40381956f76b91d9ec19c34c0a81791702fdcae68e35a7271816040516104aa9190610c0e565b60405180910390a180915050919050565b60006060600267ffffffffffffffff811180156104d757600080fd5b5060405190808252806020026020018201604052801561051157816020015b6104fe6106ea565b8152602001906001900390816104f65790505b50905060405180604001604052806040518060400160405280600381526020017f61676500000000000000000000000000000000000000000000000000000000008152508152602001858152508160008151811061056b57fe5b602002602001018190525060405180604001604052806040518060400160405280600381526020017f74656c0000000000000000000000000000000000000000000000000000000000815250815260200184815250816001815181106105cd57fe5b602002602001018190525060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166301fa804c87846040518363ffffffff1660e01b8152600401610636929190610c4b565b602060405180830381600087803b15801561065057600080fd5b505af1158015610664573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068891906108b1565b60030b90507fd72ab475a08df05fbd4f7f8cb4db1ad9dbdc26f54437fa6794acd97357779d2a816040516106bc9190610c0e565b60405180910390a180925050509392505050565b604051806040016040528060608152602001606081525090565b604051806040016040528060608152602001606081525090565b600082601f83011261071557600080fd5b815161072861072382610d1d565b610cf0565b9150818183526020840193506020810190508360005b8381101561076e578151860161075488826107e1565b84526020840193506020830192505060018101905061073e565b5050505092915050565b60008151905061078781610e7a565b92915050565b600082601f83011261079e57600080fd5b81356107b16107ac82610d45565b610cf0565b915080825260208301602083018583830111156107cd57600080fd5b6107d8838284610e27565b50505092915050565b600082601f8301126107f257600080fd5b815161080561080082610d45565b610cf0565b9150808252602083016020830185838301111561082157600080fd5b61082c838284610e36565b50505092915050565b60006040828403121561084757600080fd5b6108516040610cf0565b9050600082015167ffffffffff","ffffff81111561086d57600080fd5b610879848285016107e1565b600083015250602082015167ffffffffffffffff81111561089957600080fd5b6108a584828501610704565b60208301525092915050565b6000602082840312156108c357600080fd5b60006108d184828501610778565b91505092915050565b6000602082840312156108ec57600080fd5b600082013567ffffffffffffffff81111561090657600080fd5b6109128482850161078d565b91505092915050565b60008060006060848603121561093057600080fd5b600084013567ffffffffffffffff81111561094a57600080fd5b6109568682870161078d565b935050602084013567ffffffffffffffff81111561097357600080fd5b61097f8682870161078d565b925050604084013567ffffffffffffffff81111561099c57600080fd5b6109a88682870161078d565b9150509250925092565b6000602082840312156109c457600080fd5b600082015167ffffffffffffffff8111156109de57600080fd5b6109ea84828501610835565b91505092915050565b60006109ff8383610b14565b905092915050565b6000610a138383610bca565b905092915050565b6000610a2682610d91565b610a308185610dcc565b935083602082028501610a4285610d71565b8060005b85811015610a7e5784840389528151610a5f85826109f3565b9450610a6a83610db2565b925060208a01995050600181019050610a46565b50829750879550505050505092915050565b6000610a9b82610d9c565b610aa58185610ddd565b935083602082028501610ab785610d81565b8060005b85811015610af35784840389528151610ad48582610a07565b9450610adf83610dbf565b925060208a01995050600181019050610abb565b50829750879550505050505092915050565b610b0e81610e10565b82525050565b6000610b1f82610da7565b610b298185610dee565b9350610b39818560208601610e36565b610b4281610e69565b840191505092915050565b6000610b5882610da7565b610b628185610dff565b9350610b72818560208601610e36565b610b7b81610e69565b840191505092915050565b60006040830160008301518482036000860152610ba38282610b14565b91505060208301518482036020860152610bbd8282610a1b565b9150508091505092915050565b60006040830160008301518482036000860152610be78282610b14565b91505060208301518482036020860152610c018282610b14565b9150508091505092915050565b6000602082019050610c236000830184610b05565b92915050565b60006020820190508181036000830152610c438184610b4d565b905092915050565b60006040820190508181036000830152610c658185610b4d565b90508181036020830152610c798184610a90565b90509392505050565b60006060820190508181036000830152610c9c8186610b4d565b90508181036020830152610cb08185610b4d565b90508181036040830152610cc48184610b4d565b9050949350505050565b60006020820190508181036000830152610ce88184610b86565b905092915050565b6000604051905081810181811067ffffffffffffffff82111715610d1357600080fd5b8060405250919050565b600067ffffffffffffffff821115610d3457600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115610d5c57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000819050919050565b60008160030b9050919050565b82818337600083830152505050565b60005b83811015610e54578082015181840152602081019050610e39565b83811115610e63576000848401525b50505050565b6000601f19601f8301169050919050565b610e8381610e1a565b8114610e8e57600080fd5b5056fea264697066735822122060b020054fa271d9a686393f6fdf42e18bd0a582331de5e96dbda8ae40052c2b64736f6c634300060a0033"};

    public static final String SM_BINARY = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"count\",\"type\":\"int256\"}],\"name\":\"CreateResult\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"count\",\"type\":\"int256\"}],\"name\":\"InsertResult\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"count\",\"type\":\"int256\"}],\"name\":\"RemoveResult\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"count\",\"type\":\"int256\"}],\"name\":\"UpdateResult\",\"type\":\"event\"},{\"conflictFields\":[{\"kind\":0}],\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"age\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"tel\",\"type\":\"string\"}],\"name\":\"insert\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"selector\":[803838940,388276610],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"conflictFields\":[{\"kind\":0}],\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"remove\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"selector\":[2153356875,2260153337],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"conflictFields\":[{\"kind\":0}],\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"name\":\"select\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"selector\":[4242006977,1530027384],\"stateMutability\":\"view\",\"type\":\"function\"},{\"conflictFields\":[{\"kind\":0}],\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"age\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"tel\",\"type\":\"string\"}],\"name\":\"update\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"selector\":[834921558,2607521945],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_INSERT = "insert";

    public static final String FUNC_REMOVE = "remove";

    public static final String FUNC_SELECT = "select";

    public static final String FUNC_UPDATE = "update";

    public static final Event CREATERESULT_EVENT = new Event("CreateResult", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    ;

    public static final Event INSERTRESULT_EVENT = new Event("InsertResult", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    ;

    public static final Event REMOVERESULT_EVENT = new Event("RemoveResult", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    ;

    public static final Event UPDATERESULT_EVENT = new Event("UpdateResult", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    ;

    protected TestCRUD(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public static String getABI() {
        return ABI;
    }

    public List<CreateResultEventResponse> getCreateResultEvents(
            TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(CREATERESULT_EVENT, transactionReceipt);
        ArrayList<CreateResultEventResponse> responses = new ArrayList<CreateResultEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            CreateResultEventResponse typedResponse = new CreateResultEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.count = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public List<InsertResultEventResponse> getInsertResultEvents(
            TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(INSERTRESULT_EVENT, transactionReceipt);
        ArrayList<InsertResultEventResponse> responses = new ArrayList<InsertResultEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            InsertResultEventResponse typedResponse = new InsertResultEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.count = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public List<RemoveResultEventResponse> getRemoveResultEvents(
            TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(REMOVERESULT_EVENT, transactionReceipt);
        ArrayList<RemoveResultEventResponse> responses = new ArrayList<RemoveResultEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            RemoveResultEventResponse typedResponse = new RemoveResultEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.count = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public List<UpdateResultEventResponse> getUpdateResultEvents(
            TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(UPDATERESULT_EVENT, transactionReceipt);
        ArrayList<UpdateResultEventResponse> responses = new ArrayList<UpdateResultEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            UpdateResultEventResponse typedResponse = new UpdateResultEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.count = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public TransactionReceipt insert(String name, String age, String tel) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new Utf8String(name),
                new Utf8String(age),
                new Utf8String(tel)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return executeTransaction(function);
    }

    public String insert(String name, String age, String tel, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new Utf8String(name),
                new Utf8String(age),
                new Utf8String(tel)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForInsert(String name, String age, String tel) {
        final Function function = new Function(
                FUNC_INSERT, 
                Arrays.<Type>asList(new Utf8String(name),
                new Utf8String(age),
                new Utf8String(tel)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return createSignedTransaction(function);
    }

    public Tuple3<String, String, String> getInsertInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_INSERT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple3<String, String, String>(

                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue()
                );
    }

    public Tuple1<BigInteger> getInsertOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_INSERT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public TransactionReceipt remove(String name) {
        final Function function = new Function(
                FUNC_REMOVE, 
                Arrays.<Type>asList(new Utf8String(name)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return executeTransaction(function);
    }

    public String remove(String name, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_REMOVE, 
                Arrays.<Type>asList(new Utf8String(name)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForRemove(String name) {
        final Function function = new Function(
                FUNC_REMOVE, 
                Arrays.<Type>asList(new Utf8String(name)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return createSignedTransaction(function);
    }

    public Tuple1<String> getRemoveInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_REMOVE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<String>(

                (String) results.get(0).getValue()
                );
    }

    public Tuple1<BigInteger> getRemoveOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_REMOVE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public Tuple3<String, String, String> select(String name) throws ContractException {
        final Function function = new Function(FUNC_SELECT, 
                Arrays.<Type>asList(new Utf8String(name)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple3<String, String, String>(
                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue());
    }

    public TransactionReceipt update(String name, String age, String tel) {
        final Function function = new Function(
                FUNC_UPDATE, 
                Arrays.<Type>asList(new Utf8String(name),
                new Utf8String(age),
                new Utf8String(tel)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return executeTransaction(function);
    }

    public String update(String name, String age, String tel, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_UPDATE, 
                Arrays.<Type>asList(new Utf8String(name),
                new Utf8String(age),
                new Utf8String(tel)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdate(String name, String age, String tel) {
        final Function function = new Function(
                FUNC_UPDATE, 
                Arrays.<Type>asList(new Utf8String(name),
                new Utf8String(age),
                new Utf8String(tel)),
                Collections.<TypeReference<?>>emptyList(), 0);
        return createSignedTransaction(function);
    }

    public Tuple3<String, String, String> getUpdateInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_UPDATE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple3<String, String, String>(

                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue()
                );
    }

    public Tuple1<BigInteger> getUpdateOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_UPDATE, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
        List<Type> results = this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public static TestCRUD load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new TestCRUD(contractAddress, client, credential);
    }

    public static TestCRUD deploy(Client client, CryptoKeyPair credential) throws
            ContractException {
        return deploy(TestCRUD.class, client, credential, getBinary(client.getCryptoSuite()), getABI(), null, null);
    }

    public static class CreateResultEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger count;
    }

    public static class InsertResultEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger count;
    }

    public static class RemoveResultEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger count;
    }

    public static class UpdateResultEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger count;
    }

    @Override
    public String toString() {
        return "TestCRUD{" +
                "contractAddress='" + contractAddress + '\'' +
                '}';
    }
}
